package BanqueGestion;

/**
 * Interface definition: CompteBancaire.
 * 
 * @author OpenORB Compiler
 */
public abstract class CompteBancairePOA extends org.omg.PortableServer.Servant
        implements CompteBancaireOperations, org.omg.CORBA.portable.InvokeHandler
{
    public CompteBancaire _this()
    {
        return CompteBancaireHelper.narrow(_this_object());
    }

    public CompteBancaire _this(org.omg.CORBA.ORB orb)
    {
        return CompteBancaireHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:BanqueGestion/CompteBancaire:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("_get_argent")) {
                return _invoke__get_argent(_is, handler);
        } else if (opName.equals("_get_nom")) {
                return _invoke__get_nom(_is, handler);
        } else if (opName.equals("_get_numeroDeCompte")) {
                return _invoke__get_numeroDeCompte(_is, handler);
        } else if (opName.equals("_set_nom")) {
                return _invoke__set_nom(_is, handler);
        } else if (opName.equals("deposerArgent")) {
                return _invoke_deposerArgent(_is, handler);
        } else if (opName.equals("retirerArgent")) {
                return _invoke_retirerArgent(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke__get_numeroDeCompte(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg = numeroDeCompte();
        _output = handler.createReply();
        _output.write_long(arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke__get_argent(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        float arg = argent();
        _output = handler.createReply();
        _output.write_float(arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke__get_nom(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg = nom();
        _output = handler.createReply();
        _output.write_string(arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke__set_nom(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String result = _is.read_string();

        nom(result);
        _output = handler.createReply();
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_deposerArgent(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        float arg0_in = _is.read_float();

        try
        {
            deposerArgent(arg0_in);

            _output = handler.createReply();

        }
        catch (BanqueGestion.CompteBancairePackage.NegativeAmount _exception)
        {
            _output = handler.createExceptionReply();
            BanqueGestion.CompteBancairePackage.NegativeAmountHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_retirerArgent(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        float arg0_in = _is.read_float();

        try
        {
            float _arg_result = retirerArgent(arg0_in);

            _output = handler.createReply();
            _output.write_float(_arg_result);

        }
        catch (BanqueGestion.CompteBancairePackage.NotEnoughMoney _exception)
        {
            _output = handler.createExceptionReply();
            BanqueGestion.CompteBancairePackage.NotEnoughMoneyHelper.write(_output,_exception);
        }
        catch (BanqueGestion.CompteBancairePackage.NegativeAmount _exception)
        {
            _output = handler.createExceptionReply();
            BanqueGestion.CompteBancairePackage.NegativeAmountHelper.write(_output,_exception);
        }
        return _output;
    }

}
